When a current is caused to flow in a forward direction between a p+-type anode layer and an n+-type cathode layer in a diode, a large number of carriers are accumulated in an n−-type drift layer. Thereafter, when a switch is turned off, the accumulated carriers are discharged and recovery currents (reverse recovery currents) flow. During recovery operation, both the carriers accumulated in an active region and the carriers accumulated in a terminal region flow into the p+-type anode layer. The recovery currents are therefore concentrated on an end portion of the p+-type anode layer to strengthen the electric field and increase the temperature thereof, thereby increasing the possibility of breakdown. A diode having a recess formed by trenching the n+-type cathode layer in the terminal region to prevent this phenomenon has been proposed (see, for example, FIG. 3 of Patent Literature 1).